﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace dzs.Web.supplierinfo
{
    public partial class Add : Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSave_Click(object sender, EventArgs e)
        {

            string strErr = "";
            //if (this.txtsno.Text.Trim().Length == 0)
            //{
            //    strErr += "供应商编号不能为空！\\n";
            //}
            if (this.txtsname.Text.Trim().Length == 0)
            {
                strErr += "名称不能为空！\\n";
            }
            //if (this.txtsadd.Text.Trim().Length == 0)
            //{
            //    strErr += "地址不能为空！\\n";
            //}
            //if (this.txtslink.Text.Trim().Length == 0)
            //{
            //    strErr += "业务联系人不能为空！\\n";
            //}
            //if (this.txtsphone.Text.Trim().Length == 0)
            //{
            //    strErr += "业务联系人电话不能为空！\\n";
            //}
            //if (this.txtsfax.Text.Trim().Length == 0)
            //{
            //    strErr += "业务联系人传真不能为空！\\n";
            //}
            //if (this.txtsemail.Text.Trim().Length == 0)
            //{
            //    strErr += "业务联系人Email不能为空！\\n";
            //}
            //if (this.txtpslink.Text.Trim().Length == 0)
            //{
            //    strErr += "配送联系人不能为空！\\n";
            //}
            //if (this.txtpsphone.Text.Trim().Length == 0)
            //{
            //    strErr += "配送联系人电话不能为空！\\n";
            //}
            //if (this.txtpsfax.Text.Trim().Length == 0)
            //{
            //    strErr += "配送联系人传真不能为空！\\n";
            //}
            //if (this.txtpsemail.Text.Trim().Length == 0)
            //{
            //    strErr += "配送联系人Email不能为空！\\n";
            //}

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string sno = this.txtsno.Text;
            string sname = this.txtsname.Text;
            string sadd = this.txtsadd.Text;
            string slink = this.txtslink.Text;
            string sphone = this.txtsphone.Text;
            string sfax = this.txtsfax.Text;
            string semail = this.txtsemail.Text;
            string pslink = this.txtpslink.Text;
            string psphone = this.txtpsphone.Text;
            string psfax = this.txtpsfax.Text;
            string psemail = this.txtpsemail.Text;

            dzs.Model.supplierinfo model = new dzs.Model.supplierinfo();
            model.sno = sno;
            model.sname = sname;
            model.sadd = sadd;
            model.slink = slink;
            model.sphone = sphone;
            model.sfax = sfax;
            model.semail = semail;
            model.pslink = pslink;
            model.psphone = psphone;
            model.psfax = psfax;
            model.psemail = psemail;

            dzs.BLL.supplierinfo bll = new dzs.BLL.supplierinfo();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "Add.aspx");

        }
        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("List.aspx");
        }
    }
}
